import { PureComponent } from "react"
import isLoginHOC from "../../components/04Cart/isLoginHOC"
import propTypes from "./cartProps"
const Cpn1Name = "购物车"
const Cpn2Name = "订单页"
class Cpn1 extends PureComponent {
  constructor() {
    super()
  }

  render() {
    const { removeToken } = this.props
    return (
      <div>
        <span>{Cpn1Name}</span>
        <span style={{ padding: "20px" }}></span>
        <button onClick={removeToken}>退出登录</button>
      </div>
    )
  }
}

class Cpn2 extends PureComponent {
  constructor() {
    super()
  }

  render() {
    const { removeToken } = this.props
    return (
      <div>
        <span>{Cpn2Name}</span>
        <span style={{ padding: "20px" }}></span>
        <button onClick={removeToken}>退出登录</button>
      </div>
    )
  }
}

Cpn1.propTypes = propTypes
Cpn2.propTypes = propTypes
// 做了一层高阶组件的拦截
export const Cart1 = isLoginHOC(Cpn1, Cpn1Name)
export const Cart2 = isLoginHOC(Cpn2, Cpn2Name)
